<?php
namespace Home\Common;
use Think\Behavior;

// 开发者：杨晓杰，
// 邮箱：2902468225@qq.com 


// 页面需要的的基本信息
class basicInfoBehavior extends Behavior {
	public function run(&$params) {
		//平台信息
		$_ENV['site']=M('site')->where('id = 1')->select();

		// banner
		$_ENV['banner']=M('banner')->where('status = 1')->order('sort asc')->select();

		//侧边栏-竞赛
		$_ENV['sidebar_competition']=M('competition')->join('__SCHOOL_ORG__ ON __COMPETITION__.school_id = __SCHOOL_ORG__.id')->where('tswc_competition.is_verify = 1')->order('cpt_id desc')->limit(3)->select();

		// 侧边栏竞赛结果
		$_ENV['sidebar_result']=M('competition_result')->join('__COMPETITION__ ON __COMPETITION_RESULT__.cpt_id=__COMPETITION__.cpt_id')->order('id desc')->limit(4)->select();

		//侧边栏-资讯
		$_ENV['sidebar_news']=M('news')->order('id desc')->limit(6)->select();

		// 行业
		$_ENV['industry']=M('industry')->order('hot desc')->limit(5)->select();

		// 地区
		$_ENV['area']=M('area')->order('hot desc')->limit(5)->select();

		// 专业
		$_ENV['profession']=M('profession')->order('hot desc')->limit(5)->select();

		//学校
		$_ENV['school']=M('school')->order('hot desc')->limit(5)->select();

		//消息数量
		if($_ENV['user']['id'])$_ENV['msgNum']=count(M('std_msg')->where('std_id = '.$_ENV['user']['id'].' and status = 0')->select());
	}
}